<template>
  <div>
    <!-- 思路：可以是两部分 -->
    <div>
      <h4>{{ msg }}</h4>
      <!-- 用lable可以扩大用户点击范围，提高了用户体验 -->
      <lable v-for="(item, index) in arr" :key="index">
        <input type="checkbox" v-model="hobby" :value="item" />{{ item }}
      </lable>
    </div>

    <div>
      <ul>
        <li v-for="(item, index) in hobby" :key="index">{{ item }}</li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "请选择你喜欢的专栏",
      hobby: [],
      arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
    };
  },
};
</script>

<style scoped></style>
